package main

import (
	"fmt"
	"net"
)

func main() {

	addr, err := net.LookupHost("www.baidu")
	if err.(*net.DNSError) != nil {
		DNSerr, _ := err.(*net.DNSError)
		if DNSerr.Timeout() {
			fmt.Println("DNS timeout")
		} else if DNSerr.IsNotFound {
			fmt.Println("DNS not found")
		} else {
			fmt.Println("DNS unknown")
		}
	}
	if err != nil {
		fmt.Println("err =", err)
		return
	}
	println(addr)
}
